<% if session[:user_id] == nil %>
  <% permission = 0 %>
<% else %>
  <% user = User.find( session[:user_id] ) %>
  <% permission = user.permission %>
<% end %>

<form>
  <fieldset>
	<legend><span class="STYLE7 STYLE6"><span class="STYLE9">功能选项</span></span></legend>
        <p></p>
        <% if permission == 0 %>
          <p class="STYLE10"><%= link_to "注册" , :controller=>"users", :action=>"new" %></p>
        <% elsif permission==1 %>
          <p class="STYLE10"><%= link_to "发帖", :controller=>"topics", :action=>"new"  %></p>
          <p class="STYLE10"><%= link_to_remote "查看个人信息",  :url=>{:controller=>"users", :action=>"show" ,:id=>session[:user_id] }%></p>
          <p class="STYLE10"><%= link_to "修改个人信息", :controller=>"users", :action=>"edit_self" ,:id=>session[:user_id] %></p>
          <p class="STYLE10"><%= link_to "志愿者申请", :controller=>"volunteers", :action=>"new"  %></p>
        <% elsif permission == 2 %>
          <p class="STYLE10"><%= link_to "发帖", :controller=>"topics", :action=>"new"  %></p>
          <p class="STYLE10"><%= link_to_remote "查看个人信息",  :url=>{:controller=>"users", :action=>"show" ,:id=>session[:user_id] }%></p>
          <p class="STYLE10"><%= link_to "修改个人信息", :controller=>"users", :action=>"edit_self" ,:id=>session[:user_id] %></p>
        <% elsif permission == 3 %>
          <p class="STYLE10"><%= link_to "发帖", :controller=>"topics", :action=>"new"  %></p>
          <p class="STYLE10"><%= link_to_remote "查看个人信息",  :url=>{:controller=>"users", :action=>"show" ,:id=>session[:user_id] }%></p>
          <p class="STYLE10"><%= link_to "修改个人信息", :controller=>"users", :action=>"edit_self" ,:id=>session[:user_id] %></p>
          <p class="STYLE10"><%= link_to "发起活动", :controller=>"activity", :action=>"new_activity" %></p>
          <p class="STYLE10"><%= link_to_remote "查看我的活动", :url=>{:controller=>"activity", :action=>"my_activities"} %></p>
        <% elsif permission==4 %>
          <p class="STYLE10"><%= link_to "发帖", :controller=>"topics", :action=>"new"  %></p>
          <p class="STYLE10"><%= link_to_remote "查看个人信息",:url=>{ :controller=>"users", :action=>"show",  :id=>session[:user_id]} %></p>
          <p class="STYLE10"><%= link_to "修改个人信息", :controller=>"users", :action=>"edit_self" ,:id=>session[:user_id] %></p>
          <p class="STYLE10"><%= link_to_remote "查看活动申请", :url=>{ :controller=>"activity", :action=>"cognizance"} %></p>
        <% elsif permission==5 %>
          <p class="STYLE10"><%= link_to_remote "查看个人信息",  :url=>{:controller=>"users", :action=>"show" ,:id=>session[:user_id] }%></p>
          <p class="STYLE10"><%= link_to "修改个人信息", :controller=>"users", :action=>"edit_self" ,:id=>session[:user_id] %></p>
          <p class="STYLE10"><%= link_to_remote "查看志愿者申请", :url=>{ :controller=>"volunteers", :action=>"cognizancee"} %></p>
          <p class="STYLE10"><%= link_to "系统管理", :controller=>"users" ,:action=>"index"%></p>
        <% end %>
  </fieldset>
</form>
